---@class UIExpeditionFinalBossReward : UIBase
UIExpeditionFinalBossReward = UIBase.New(PanelResNames.UIExpeditionFinalBossReward)
local t = UIExpeditionFinalBossReward

function t.Init(dataList,closeCallback,callbacktb)
    t.dataList = dataList
    t.closeCallback = closeCallback
    t.callbacktb = callbacktb
    UIBase.Init(t)
end

function t:OnCreate()
    self.ctrl = self:GetController("FirstClear")
    self.btnClose = self:GetChild("btnClose")
    self.itemList = self:GetList("Content")

    self:SetDynamicList(self.itemList,self.ItemRender)
    self:RegisterOnClick(self.btnClose,self.ClickClose)
end

function t:OnEnable()
    self:Refresh()
end
function t:OnDisable()

end
function t:OnDestroy()
    t.dataList = nil
end
function t:Refresh()
    t.dataList = logicMgr.ExpeditionMgr.wards
    if t.dataList and #t.dataList > 0 then
        self.ctrl.selectedIndex = 1
        self.itemList.numItems = #t.dataList
    else
        self.ctrl.selectedIndex = 0
    end
end
function t:ItemRender(index,go)
    local data = t.dataList[index]
    logicMgr.CostManager.RefreshItem(go, {data.itemModelId, data.num});
    --local item = logicMgr.CtrlManager.GetCtrl(PanelNames.Item)
    --item.initData(go,data)
end
function t:ClickClose()
    closeUI(PanelResNames.UIExpeditionFinalBossReward)
    if t.closeCallback then
        t.closeCallback(t.callbacktb)
    end
    t.closeCallback = nil
    t.callbacktb = nil
end
return t